package cz.cvut.fit.mi.dpo.mvc.model.elements;

import cz.cvut.fit.mi.dpo.mvc.model.ZeroSizeException;

/**
 * @author David Pertl
 * @author Martin Štekl <steklmar@fit.cvut.cz>
 */
public class Circle extends AElement {

    private int radius;

    public Circle(int x, int y, int radius) throws ZeroSizeException {
        super(x, y);
        setRadius(radius);
    }

    public int getRadius() {
        return radius;
    }

    public Circle setRadius(int radius) throws ZeroSizeException {
        if (radius < 0) {
            throw new ZeroSizeException("Radius of circle cannot be less than zero.");
        }
        this.radius = radius;
        return this;
    }

    public int getDiameter() {
        return 2 * radius;
    }
}
